<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>待付款</title>
		<link href="/static/lvshi_pc/css/person.css" rel="stylesheet" />
		<link href="/static/lvshi_pc/css/swiper-bundle.min.css" rel="stylesheet" />
		<link href="/static/lvshi_pc/css/animate.min.css" rel="stylesheet" />
		<link href="/static/lvshi_pc/css/reset.min.css" rel="stylesheet" />
		<script src="/static/lvshi_pc/js/swiper-bundle.min.js"></script>
		<script src="/static/lvshi_pc/js/jquery.min.js"></script>
		<script src="/static/lvshi_pc/js/wow.min.js"></script>
		<script src="/static/lvshi_pc/js/changeWindow.js"></script>
		<script src="/static/layer/layer.js"></script>
		<script src="/static/global/js/global.js"></script>
		<script src="/static/elementUi/axios.min.js"></script>
		<script src="/static/elementUi/Api.js"></script>
	</head>
	<body>
		<header>
			{include file="public/header"}
		</header>
		<img src="/static/lvshi_pc/images/bannera_02.png" class="banner" alt="">

		<div class="xinbg">
			<div class="wrap">
				<div class="xinbox">
					<div class="xintitle">订单信息</div>
					<div class="dantop">
						<div class="alicen">
							<div class="dantda">订单号：{$order.order_no}</div>
							<div class="dantda">订单类型：普通订单</div>
							<div class="dantda">下单时间：{$order.info.create_time|date="Y-m-d H:i"}</div>
							{if isset($order.info.pay_time)}
							<div class="dantda">支付时间：{$order.info.pay_time|date="Y-m-d H:i"}</div>
							{/if}
							{if isset($order.info.finish_time)}
							<div class="dantda">完成时间：{$order.info.finish_time|date="Y-m-d H:i"}</div>
							{/if}
						</div>
						<div class="haolan">{$order.status_name}</div>
					</div>
					<div class="chanboxact">
						<img src="/static/lvshi_pc/images/chan_03.png" class="chanpic" alt="">
						<div class="chanyou">
							<div class="chantitle">{$order.body.goods.title}</div>
							<div class="chandi">
								<div class="chanjia">
									￥<span>{$order.money}</span>
								</div>
								<a href="{$order.body.goods.down_path}" download="{$order.body.goods.title}">
									<img id="down" style="display: none" src="/static/lvshi_pc/images/down_03.png" class="down" alt="">
								</a>
							</div>
						</div>
					</div>
					<div class="sbox">
						{if $order.status == 1 && $order.body.goods.category_id == 3}
						<div class="quque">
							<img src="/static/lvshi_pc/images/tiao_03.png" id="barcode" class="tiao" alt="">
						</div>
						{/if}
						<div class="yingtxt">
							商品金额
							<span>￥{$order.money}</span>
						</div>
						<div class="yingtxt">
							应付金额
							<span>￥{$order.money}</span>
						</div>
						{if $order.status == -1}
						<div class="quque pt20">
							<div class="quli" onclick="cancel()">
								取消订单
							</div>
							<div class="queli" id="lifu">
								立即付款
							</div>
						</div>
						{/if}
					</div>
				</div>
			</div>
		</div>
		<div class="popmask">
			<div class="popnei">
				<div class="tanbox">
					<img src="/static/lvshi_pc/images/xxx_07.png" class="xxx" alt="">
					<div class="tanli">立即支付</div>
					<div class="tannei">
						<div class="tantitle">
							订单编号: <span>{$order.order_no}</span>
						</div>
						<div class="tantitle">
							订单标题: <span>购买{$order.body.goods.title}</span>
						</div>
						<div class="tantitle">
							订单价格: <span>￥{$order.money}</span>
						</div>
						
						<div class="zhidi">
							<div class="zhileft">
								<img src="/static/lvshi_pc/images/wei_03.png" class="weipic" alt="">
								<textarea class="weiarea" id="bz" placeholder="请输入您的订单备注"></textarea>
								<div class="yiwei">
									<div class="yibox">未付款</div>
									<div class="yibox active" onclick="submit()">已付款</div>
								</div>
							</div>
							<div class="zhiyou">
								<img src="/static/lvshi_pc/images/erma_03.png" id="qrcode" class="fmapic" alt="">
								<div class="place">
									<img src="/static/lvshi_pc/images/saom_03.png" class="plpic" alt="">
									<div class="pltxt">
										请使用微信扫一扫</br>扫描二维码支付
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<footer>
			{include file="public/footer"}
		</footer>
		<script type="text/javascript">
			let status = "{$order.status}"
			let category_id = "{$order.body.goods.category_id}"
			function submit() {
				Api.my("/index/order/update",{order_id:"{$order.id}",bz:$("#bz").val()}).then(res=>{
					if (res.code == 1) {
						location.href = "/index/index/service"
						
					}
				})
			}
			if (status == 1 && category_id == 3) {
				getBarCode()
			}
			if (status == 2 && category_id == 1) {
				$("#down").show()
			}
			function getBarCode() {
				Api.my("/index/order/getBarcode",{order_id:"{$order.id}"}).then(res=>{
					if (res.code == 1) {
						$("#barcode").attr("src",res.data.barcode)
					}
				})
			}
			function cancel(){
				if(confirm('确定取消')) {
					Api.my("/index/order/cancel",{order_id:"{$order.id}"}).then(res=>{
						if (res.code == 1) {
							showSuccessMsgCall('已取消',()=>{
								location.href = "/index/index/service"
							})
						} else {
							showErrMsg(res.msg)
						}
					})
				}
			}
			$('#lifu').click(function(){
				Api.my("/index/order/nativePay",{order_id:"{$order.id}"}).then(res=>{
					if (res.code == 1) {
						$("#qrcode").attr("src",res.data.qrcode)
						$('.popmask').show(500)
					} else {
						showErrMsg(res.msg)
					}
				})
			})
			$('.xxx').click(function(){
				$('.popmask').hide(500)
			})
			// wow效果启用
			new WOW().init();
		</script>
	</body>

</html>